﻿using Quartz;
using System;
using System.Threading.Tasks;

namespace BingDesktop
{
    public class BackJob : IJob
    {
        public async Task Execute(IJobExecutionContext context)
        {
            await Task.Run(() =>
            Session0Through.CreateProcess($"{AppDomain.CurrentDomain.BaseDirectory}Worker.exe", null));


            //int errCode = Marshal.GetLastWin32Error();
            //var b = GetSysErrMsg(errCode);
            //File.WriteAllText("D:\\aaa.txt", b);
        }

        //[System.Runtime.InteropServices.DllImport("Kernel32.dll")]
        //public extern static int FormatMessage(int flag, ref IntPtr source, int msgid, int langid, ref string buf, int size, ref IntPtr args);
        //private static string GetSysErrMsg(int errCode)
        //{
        //    IntPtr tempptr = IntPtr.Zero;
        //    string msg = null;
        //    FormatMessage(0x1300, ref tempptr, errCode, 0, ref msg, 255, ref tempptr);
        //    return msg;
        //}
    }
}
